package com.codermn.day715;

import java.util.HashMap;
import java.util.Map;

/**
 * @author jxau_scf
 * @date 2021/7/15 - 18:57
 */
public class SingleMap {
    private static Map<String, SingleMap> map = new HashMap();
    private SingleMap(){}
    public synchronized static SingleMap getInstance() throws ClassNotFoundException, IllegalAccessException, InstantiationException {
        if (null != map.get("SingleMap")){
            return map.get("SingleMap");
        }
//        map.put("SingleMap",new SingleMap());
        map.put("SingleMap", (SingleMap) Class.forName("com.codermn.day715.SingleMap").newInstance());
        return map.get("SingleMap");
    }

    public static void main(String[] args) throws IllegalAccessException, InstantiationException, ClassNotFoundException {
//        System.out.println(SingleMap.getInstance());
        System.out.println(SingleMap.getInstance().toString());
    }

}


